package cn.iocoder.yudao.module.reading.controller.app.assignment.vo;

import cn.iocoder.yudao.module.reading.framework.vo.BaseUrlConvertVO;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;

import java.time.LocalDateTime;

/**
 * 作业完成记录 Response VO
 *
 * @author 芋道源码
 */
@Schema(description = "用户 APP - 作业完成记录 Response VO")
@Data
@EqualsAndHashCode(callSuper = false)
public class AssignmentCompletionRespVO extends BaseUrlConvertVO {

    @Schema(description = "用户ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
    private Long userId;

    @Schema(description = "用户昵称", requiredMode = Schema.RequiredMode.REQUIRED, example = "小明")
    private String nickname;

    @Schema(description = "用户头像", example = "/static/avatars/boy1.png")
    private String avatar;

    @Schema(description = "完成时间", example = "2025-01-03T19:30:00")
    private LocalDateTime completedAt;

    @Schema(description = "已完成绘本数", requiredMode = Schema.RequiredMode.REQUIRED, example = "2")
    private Integer completedBooks;

    @Schema(description = "总绘本数", requiredMode = Schema.RequiredMode.REQUIRED, example = "2")
    private Integer totalBooks;

    @Schema(description = "完成状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "已配音")
    private String status;

    @Schema(description = "配音文件URL", example = "/static/recordings/user1_book1.mp3")
    private String recordingUrl;

    @Schema(description = "评分", example = "85")
    private Integer score;

    /**
     * 转换URL字段
     * 将相对路径转换为完整URL
     */
    @Override
    public void convertUrls() {
        this.avatar = convertUrl(this.avatar);
        this.recordingUrl = convertUrl(this.recordingUrl);
    }

}
